package ${packageCode}.func.vx.${moduleMapperCode}.${businessCode?uncap_first};

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.springframework.stereotype.Component;
import ${packageCode}.${moduleMapperCode}.service.${businessCode}Service;
import top.cardone.context.ApplicationContextHolder;
import top.cardone.context.util.MapUtils;
import top.cardone.context.util.StringUtils;
import top.cardone.core.CodeException;
import top.cardone.core.util.func.Func1;

import java.util.Map;

/**
 * ${businessName!} - 删除
 */
@Component("/vx/${moduleMapperCode}/${businessCode?uncap_first}/d0004.json")
public class D0004Func implements Func1<Object, Map<String, Object>> {
    private Table<String, String, String> inputConfigTable;

    public D0004Func() {
        inputConfigTable = HashBasedTable.create();
		
		inputConfigTable.put("${businessMapper.code?uncap_first}Ids", "funcBeanId", "escapeSqlFunc");
    }

    @Override
    public Object func(Map<String, Object> inputMap) {
        inputMap.putAll(top.cardone.context.util.MapUtils.newHashMap(inputMap, inputConfigTable));

        validate(inputMap);
		
        return ApplicationContextHolder.getBean(${businessCode}Service.class).deleteByIdsCache(inputMap);
    }
	
    private  void validate(Map<String,Object>  inputMap){
        String ${businessMapper.code?uncap_first}Ids = MapUtils.getString(inputMap, "${businessMapper.code?uncap_first}Ids");

        if (StringUtils.isBlank(${businessMapper.code?uncap_first}Ids)) {
            throw new CodeException("${businessName!}标识集合不能为空值!");
        }
    }
}